﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="MantenimientoUsuario.aspx.cs" Inherits="UIWeb.MantenimientoUsuario" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">

        function selectedRol(rID, ctr) {
            if (ctr && rID) {
                var hid = document.getElementById('MainContent_hidSelectedRols');
                if (hid) {
                    var value = ',' + rID + ',';
                    if (ctr.checked) {
                        if (hid.value.length > 0) {
                            if (hid.value.indexOf(value) < 0) {
                                hid.value += value;
                            }
                        }
                        else {
                            hid.value += value;
                        }
                    }
                    else {
                        hid.value = hid.value.replace(value, '');
                    }
                }
            }
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h3>Mantenimiento de Usuarios</h3>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" DisplayAfter="10">
        <ProgressTemplate>
            <div id="ovUp" runat="server" class="over">
                Cargando...
            </div>
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:HiddenField ID="hidSelectedRols" runat="server" />
            <div>
                <div class="form" style="float: left;">
                    <div>
                        <div>
                            Nombre:
                        </div>
                        <div class="formInput">
                            <asp:TextBox ID="txtNombre" runat="server" Style="float: left;"></asp:TextBox>
                        </div>
                        <div style="float: right;">
                            <asp:RequiredFieldValidator ID="RFNombre" runat="server" ErrorMessage="Campo Requerido"
                                ValidationGroup="All" ControlToValidate="txtNombre" ForeColor="Red">*</asp:RequiredFieldValidator>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="formSpacing">
                        <div>
                            Apellido:
                        </div>
                        <div class="formInput">
                            <asp:TextBox ID="txtApellido" runat="server" Style="float: left;"></asp:TextBox>
                        </div>
                        <div style="float: right;">
                            <asp:RequiredFieldValidator ID="RFApellido" runat="server" ErrorMessage="Campo Requerido"
                                ValidationGroup="All" ControlToValidate="txtApellido" ForeColor="Red">*</asp:RequiredFieldValidator>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="formSpacing">
                        <div>
                            Nombre Usuario:
                        </div>
                        <div class="formInput">
                            <asp:TextBox ID="txtNameUsr" runat="server" Style="float: left;"></asp:TextBox>
                        </div>
                        <div style="float: right;">
                            <asp:RequiredFieldValidator ID="RFNameUser" runat="server" ErrorMessage="Campo Requerido"
                                ValidationGroup="All" ControlToValidate="txtNameUsr" ForeColor="Red">*</asp:RequiredFieldValidator>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="formSpacing">
                        <div>
                            Contraseña:
                        </div>
                        <div class="formInput">
                            <asp:TextBox ID="txtPass" runat="server" Style="float: left;" TextMode="Password"
                                EnableViewState="false"></asp:TextBox>
                        </div>
                        <div style="float: right;">
                            <asp:RequiredFieldValidator ID="RFVRepitePass" runat="server" ErrorMessage="Campo Requerido"
                                ValidationGroup="All" ControlToValidate="txtPass" ForeColor="Red">*</asp:RequiredFieldValidator>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="formSpacing">
                        <div>
                            Repita Contraseña:
                        </div>
                        <div class="formInput">
                            <asp:TextBox ID="txtPass2" runat="server" Style="float: left;" TextMode="Password"
                                EnableViewState="false"></asp:TextBox>
                        </div>
                        <div style="float: right;">
                            <asp:CompareValidator ID="CVPASS1" runat="server" ErrorMessage="No coinciden las contraseñas"
                                ControlToCompare="txtPass2" ControlToValidate="txtPass" ForeColor="Red" ValidationGroup="All">*</asp:CompareValidator>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="formSpacing">
                        <div>
                            Email:
                        </div>
                        <div class="formInput">
                            <asp:TextBox ID="txtEmail" runat="server" Style="float: left;"></asp:TextBox>
                        </div>
                        <div style="float: right;">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Campo Requerido"
                                ControlToValidate="txtEmail" ValidationGroup="All" ForeColor="Red">*</asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionEmail" runat="server" ErrorMessage="Formato email invalido"
                                ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*" ControlToValidate="txtEmail"
                                ValidationGroup="All" ForeColor="Red" Text="*">*</asp:RegularExpressionValidator>
                        </div>
                        <div class="clear">
                        </div>
                    </div>
                    <div class="formSpacing">
                        <div>
                            Roles:
                        </div>
                        <div>
                            <asp:CheckBoxList ID="checkRoles" CssClass="CheckBox" runat="server" DataTextField="Tipo"
                                EnableViewState="true" DataValueField="Id">
                            </asp:CheckBoxList>
                        </div>
                        <div class="clear">
                        </div>
                        <br />
                        <div>
                            <asp:LinkButton ID="lnkAlta" runat="server" CssClass="lnkbtn" OnClick="lnkAlta_Click"
                                ValidationGroup="All">Alta</asp:LinkButton>
                            <asp:LinkButton ID="lnkBaja" runat="server" CssClass="lnkbtn" OnClick="lnkBaja_Click">Baja</asp:LinkButton>
                            <asp:LinkButton ID="lnkModificar" runat="server" CssClass="lnkbtn" OnClick="lnkModificar_Click"
                                ValidationGroup="All">Modificar</asp:LinkButton>
                        </div>
                        <br />
                        <asp:Label ID="lblError" runat="server" ForeColor="Red"></asp:Label>
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" ValidationGroup="All" />
                    </div>
                </div>
                <div style="float: right; width: 520px;">
                    <asp:GridView ID="DGVUsuarios" runat="server" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
                        AutoGenerateSelectButton="True" AutoGenerateColumns="False" DataKeyNames="NombreUsuario"
                        CellPadding="4" ForeColor="#333333" GridLines="None"
                        Width="493px" AllowPaging="true" 
                        onpageindexchanging="DGVUsuarios_PageIndexChanging" PageSize="50">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <Columns>
                            <asp:BoundField DataField="Id" Visible="false" HeaderText="Nombre" />
                            <asp:BoundField DataField="Nombre" HeaderText="Nombre" />
                            <asp:BoundField DataField="Apellido" HeaderText="Apellido" />
                            <asp:BoundField DataField="NombreUsuario" HeaderText="Usuario" />
                            <asp:BoundField DataField="Email" HeaderText="Email" />
                        </Columns>
                        <EditRowStyle BackColor="#999999" />
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                    </asp:GridView>
                </div>
                <div class="clear">
                </div>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
